package com.gs.dao.jdbc.impl;

import java.util.ArrayList;
import java.util.List;

import com.liang.log.Log;
import com.liang.util.Page;

public class DomeQueryPage<Module> extends BaseDAOImpl{
	
	public Page<Module> queryPage(Module searchModel, int currentPage, int pageSize) {
		Page<Module> page  = null;
		String _queryQuery = "select * from Module_info";
		StringBuffer _queryWhere = new StringBuffer();
		List<Module> modules = null;
		if(null == searchModel){
//			modules = (List<Module>)jdbcTemplate.query(_queryQuery, new ModuleRowMapper());
		}else{
			List<Object> _args = new ArrayList<Object>(0);
			List<Integer> _argTypeObjs = new ArrayList<Integer>(0);
			
			if(!_queryWhere.toString().equals("")){
				_queryWhere.insert(0, " where");
			}
			_queryQuery += _queryWhere.toString();
			
			Log.info("sql:"+_queryQuery);
			int[] _argTypes = new int[_argTypeObjs.size()];
			for(int i = 0 ;  i < _argTypeObjs.size() ; i++){
				_argTypes[i] = _argTypeObjs.get(i);
			}
//			modules = (List<Module>)jdbcTemplate.query(_queryQuery, _args.toArray(), _argTypes, new ModuleRowMapper());
		}
		
		if(null == modules){
			modules = new ArrayList<Module>(0);
		}
		
		page = new Page<Module>(modules , currentPage , pageSize , modules.size());
		return page;
	}

}
